//
//  ZYPBToken.h
//  ZYWebImage
//
//  Created by wangzhipan on 2025/4/27.
//

#import <Foundation/Foundation.h>
#import "IPBToken.h"


/*
 有两种：
 
 1、一种请求有req和rsp：
        这种只需要注册一下，发时先查一下是否有注册的req和rsp
 
        收时，先找到对应register的rsp，然后转成对应的数据
 
 2、一个是广播监听：
        这种注册完就是监听block回调，必须返回一个PBToken，每一个都不一样
 */

NS_ASSUME_NONNULL_BEGIN

@class ZYPBCore;
@interface ZYPBToken : NSObject <IPBToken>
@property (nonatomic, strong, readonly) Class reqCls;
@property (nonatomic, strong, readonly) Class rspCls;


@property (nonatomic, assign, readonly) uint32_t maxType;
@property (nonatomic, assign, readonly) uint32_t minType;


- (instancetype)initWithMax:(uint32_t)maxType
                    minType:(uint32_t)minType
                   reqClass:(Class)reqClass
                   rspClass:(Class)rspClass
                     pbCore:(ZYPBCore *)core;
@end


@interface ZYPBNotificationToken : NSObject<IPBToken>
@property (nonatomic, assign, readonly) uint32_t maxType;
@property (nonatomic, assign, readonly) uint32_t minType;
@property (nonatomic, strong, readonly) Class rspCls;
@property (nonatomic, copy, nullable) ZYPBCompletedBlock completedBlock;

- (instancetype)initWithMax:(uint32_t)maxType
                    minType:(uint32_t)minType
                   rspClass:(Class)rspClass
                     pbCore:(ZYPBCore *)core;

- (void)doCompletedOfresponseObj:(nullable id)responseObj error:(nullable NSError *)error;
@end

NS_ASSUME_NONNULL_END
